package com.shardingsphere.core.config.datasource;

import com.shardingsphere.core.config.shardingsphere.DatasourceType;
import org.apache.shardingsphere.api.hint.HintManager;

public class DataSourceContextHolder {

    private static final HintManager hintManager = HintManager.getInstance();

    /**
     * 设置数据源
     *
     * @param dbName
     */
    public static void setDataSource(DatasourceType dbName) {
        hintManager.setDatabaseShardingValue(dbName.name());
    }


    /**
     * 清除上下文数据
     */
    public static void clear() {
        hintManager.close();
    }
}
